/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1618194659142_6531';

  // add your middleware config here
  config.middleware = [];  //config.middleware = ["auth"]  //http://127.0.0.1:7001/api/goods?apikey=eyJhbGciOiJIUzI1NiJ9.MTIzNDU2.jXGweo4iGdPngxob0efyzCoI5HMX04916NDDp7mrRms
  // config.middleware = ["auth"];
  // config.middleware = ["loginAuthed"];
  config.auth = {
    /* 传递给中间件的option */
    title:"中间件"
  }

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };
  config.security = {
    csrf: {
      enable: false
    }
  }
  config.jwt = {
    secret: "123456"
  }
  config.cors = {
    origin:ctx=>{
      return ctx.headers.origin
    },
    credentials: true
  }
  config.mongoose = {
    // url: 'mongodb://127.0.0.1/blog',
    // url: 'mongodb://test:123@47.108.197.28/shop?authSource=admin',
    url: 'mongodb://test:123@124.71.191.216/shop?authSource=admin',
    // url: 'mongodb://localhost:27017/shop',
    //{salePrice:{$gt:0,$lt:100}}
    options: {
      poolSize: 40,
    },
  };
  return {
    ...config,
    ...userConfig,
  };
};